package com.ms.pda.activity

import android.view.View
import androidx.databinding.ObservableBoolean
import androidx.lifecycle.ViewModel
import com.blankj.utilcode.util.ActivityUtils
import com.ms.architecture.base.DataBindingConfig
import com.ms.pda.BR
import com.ms.pda.R
import com.ms.pda.activity.storage.OrderOutActivity
import com.ms.pda.base.BaseActivity
import com.ms.pda.messenger.MainMessenger

class MainActivity : BaseActivity() {

    private var mState: MainViewModel? = null
    private var mMsger: MainMessenger? = null

    override fun initViewModel() {
        mState = getActivityScopeViewModel(MainViewModel::class.java)
        mMsger = getActivityScopeViewModel(MainMessenger::class.java)
    }

    override fun getDataBindingConfig(): DataBindingConfig? {
        return DataBindingConfig(R.layout.activity_main, BR.state, mState!!)
            .addBindingParam(BR.listener, MainListener())
            ?.addBindingParam(BR.msger, mMsger!!)
            ?.addBindingParam(BR.instance, this)
    }

    override fun loadData() {

    }

    override fun statusBarColor(): Int {
        return R.color.main_color
    }

    override fun statusBarDarkFont(): Boolean {
        return false
    }

    open inner class MainListener {
        open fun settingPage(view: View) {
            ActivityUtils.startActivity(SettingActivity::class.java)
        }

        open fun scanOut(view: View) {
            ActivityUtils.startActivity(OrderOutActivity::class.java)
        }

        open fun rfidSetting(view: View) {
            ActivityUtils.startActivity(RFIDSettingActivity::class.java)

        }
    }


    class MainViewModel : ViewModel() {

    }
}